//
//  WSPlayerFirstCell.m
//  GroupFourFM
//
//  Created by dllo on 15/12/25.
//  Copyright © 2015年 GroupFour. All rights reserved.
//

#import "WSPlayerFirstCell.h"

@interface WSPlayerFirstCell ()

@property(nonatomic,retain)UIImageView *ownerAvator;
@property(nonatomic,retain)UILabel *ownerName;
@property(nonatomic,retain)UILabel *ownerInfo;

@end

@implementation WSPlayerFirstCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createSubView];
    }
    return self;
}

- (void)createSubView {

    self.ownerAvator = [[UIImageView alloc] init];
    self.ownerAvator.backgroundColor = CLEAR;
    self.ownerAvator.layer.masksToBounds = YES;
    self.ownerAvator.layer.cornerRadius = 30;
    [self addSubview:self.ownerAvator];
    self.ownerAvator.userInteractionEnabled = YES;
    [self.ownerAvator mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(@10);
        make.top.mas_equalTo(@20);
        make.bottom.mas_equalTo(@-20);
        make.width.mas_equalTo(@60);
    }];
    
    self.ownerName = [[UILabel alloc] init];
    self.ownerName.backgroundColor = CLEAR;
    self.ownerName.font = [UIFont systemFontOfSize:15 weight:1];
    [self addSubview:self.ownerName];
    [self.ownerName mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.ownerAvator);
        make.left.equalTo(self.ownerAvator.mas_right).offset(10);
        make.height.equalTo(self.ownerAvator).multipliedBy(0.4);
        make.right.mas_equalTo(@40);
    }];
    
    self.ownerInfo = [[UILabel alloc] init];
    self.ownerInfo.backgroundColor = CLEAR;
    self.ownerInfo.font = [UIFont systemFontOfSize:13 weight:0];
    self.ownerInfo.textColor = [UIColor lightGrayColor];
    [self addSubview:self.ownerInfo];
    [self.ownerInfo mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.ownerName.mas_bottom);
        make.left.equalTo(self.ownerAvator.mas_right).offset(10);
        make.height.equalTo(self.ownerAvator).multipliedBy(0.4);
        make.right.mas_equalTo(@40);
    }];
}

- (void)setTrackModel:(WSAlbumModel *)trackModel {

    _trackModel = trackModel;
    [self.ownerAvator sd_setImageWithURL:[NSURL URLWithString:trackModel.smallLogo] placeholderImage:PLACEHOLDER_IMAGE];
    self.ownerName.text = trackModel.nickname;
    self.ownerInfo.text = trackModel.personInfo;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
